#! /bin/bash
if [ ! -f "./host.sh" -o ! -f "./directory.sh" -o ! -f "./ftp.sh" -o ! -f "./useradd.sh" -o ! -f "./ping.sh" -o ! -f "./tcp_wrapper.sh" ]; then
  echo -e '\033[31m[ERROR] Missing shell files!\033[0m'
  exit
fi
user=`whoami`
if [ $user != "root" ] 
then
  echo -e '\033[31m[ERROR] The current user is not 'root'\033[0m'
  exit
fi
while ((1))
do
    clear
    echo '
    ||===========================================================||
    ||   ______            __  __                  __  __      _ ||
    ||  / ____/___ _____  / / / /___  ____  ____ _/ / / /___ _(_)||
    || / /   / __ `/ __ \/ /_/ / __ \/ __ \/ __ `/ /_/ / __ `/ / ||
    ||/ /___/ /_/ / /_/ / __  / /_/ / / / / /_/ / __  / /_/ / /  ||
    ||\____/\__,_/\____/_/ /_/\____/_/ /_/\__, /_/ /_/\__,_/_/   ||
    ||                                   /____/                  ||
    ||===========================================================||
    ||        Linux System Information Management System         ||
    ||===========================================================||
    ||                         Main Menu                         ||
    ||===========================================================||
    ||         ID     |  Name                                    ||
    ||-----------------------------------------------------------||
    ||          1     |  主机信息                                ||
    ||-----------------------------------------------------------||
    ||          2     |  列出占用磁盘空间较多的目录              ||
    ||-----------------------------------------------------------||
    ||          3     |  ftp自动登录                             ||
    ||-----------------------------------------------------------||
    ||          4     |  建立账号                                ||
    ||-----------------------------------------------------------||
    ||          5     |  主机检测                                ||
    ||-----------------------------------------------------------||
    ||          6     |  自动建立hosts.allow和hosts.deny         ||
    ||-----------------------------------------------------------||
    ||          7     |  退出                                    ||
    ||===========================================================||
    '
    read -p 'Input your choice:' op
    case $op in
        1) bash ./host.sh;;
        2) bash ./directory.sh;;
        3) bash ./ftp.sh;;
        4) bash ./useradd.sh;;
        5) bash ./ping.sh;;
        6) bash ./tcp_wrapper.sh;;
        7) echo Bye...
        exit;;
        *) echo -e '\033[31mInvalid choice, press return key to try again...\033[0m';;
    esac
    read sure
done
